-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Iis2iclx sensor: move odr and range into dts #32168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iis2iclx sensor: move odr and range into dts #32168
Conversation
Create a common binding file that will be included by all bindings handled by iis2iclx driver. Signed-off-by: Armando Visconti <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, two minor comments
drivers/sensor/iis2iclx/iis2iclx.c
Outdated
|
|
||
| if (iis2iclx_accel_set_fs_raw(dev, | ||
| IIS2ICLX_DEFAULT_ACCEL_FULLSCALE) < 0) { | ||
| LOG_INF("range is %d", fs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe LOG_DBG?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I was infact in doubt. Seems more for debug I agree.
Thanks
drivers/sensor/iis2iclx/iis2iclx.c
Outdated
|
|
||
| iis2iclx->accel_freq = iis2iclx_odr_to_freq_val(CONFIG_IIS2ICLX_ACCEL_ODR); | ||
| if (iis2iclx_accel_set_odr_raw(dev, CONFIG_IIS2ICLX_ACCEL_ODR) < 0) { | ||
| LOG_INF("odr is %d", odr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, acked! Thx
Converts iis2iclx range options (500mg, 1g, 2g, 3g) from Kconfigs to Device Tree. Signed-off-by: Armando Visconti <[email protected]>
Move iis2iclx odr options from Kconfigs to Device Tree. Signed-off-by: Armando Visconti <[email protected]>
f44a7f7 to
85353d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine as is; noting an unrelated global change that should also be done separately.
| the signal that is presented to the driver. | ||
|
|
||
| int-pin: | ||
| type: int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's out of the PR's intended scope, and the same problem occurs elsewhere so won't block on this, but:
In another PR please review all uses of similar properties in ST devicetree bindings and make this and the others you'll find an enum too, like st,iis2dlpc's drdy-int property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pabigot
Yes, that's a good point. I'll do it in a separate PR.
Thanks
|
@pabigot |
94698c7 to
a868dc0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want more eyes on the potential change to the devicetree content before saying how this should be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be careful about this, as it breaks anybody's out-of-tree devicetree file that uses int-pin for this property.
Probably best to leave it as is, but if it's going to change both should be present, int-pin should be marked deprecated, and the driver should accept both until int-pin is removed.
If we don't have that documented as a policy somewhere, we should. @galak @mbolivar-nordic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw in #31965 that properties with name changed was marked deprecated but still present. I can do the same in fact. Thanks for pointing this out.
a868dc0 to
975f2c0
Compare
drivers/sensor/iis2iclx/iis2iclx.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be something like
COND_CODE_1(DT_HAS_PROP(DT_INST(inst), drdy_int),
(DT_INST_PROP(inst, drdy_int)),
(DT_INST_PROP(inst, int_pin)))
otherwise we're still breaking people. But that could be part of the discussion of how to handle devicetree deprecations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, correct. I did it too quickly. Sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually planning to go back to original name, even if I think that drdy-int is a better name, but I'll do it next week. In any case I think it would be productive to understand what is the policy in such a case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the fastest path to getting this in; #32225 should result in a documented policy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the fastest path to getting this in; #32225 should result in a documented policy.
Sure, just did it!
Change int-pin property type to enum, as it may only accept 1 or 2 as possible values. Signed-off-by: Armando Visconti <[email protected]>
975f2c0 to
d144f64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An intermediate commit has a whitespace issue but checkpatch doesn't see it and it gets cleaned up in the next commit, so this seems fine. Thanks for your work on this.
| - 1 # 3g (0.122 mg/LSB) | ||
| - 2 # 1g (0.031 mg/LSB) | ||
| - 3 # 2g (0.061 mg/LSB) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git commit normally complains about empty last lines, not sure why it didn't here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's corrected in the next commit.
STM IIS2ICLX inclinometer sensor
Move odr and range properties from Kconfig to DT.
Moreover, a new yaml file has been created common to I2C and SPI bus.
Tested on x_nucleo_iks01a3 shield.